home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 614 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Is this ok: *pointer++ = value ??
  5. Date: Sun, 07 Jan 96 23:26:29 GMT
  6. Organization: none
  7. Message-ID: <821057189snz@genesis.demon.co.uk>
  8. References: <4cklvv$nmm@alcor.usc.edu> <4cmmcd$e3u@gryphon.phoenix.net> <30eefb76.72646976@nntp.ix.netcom.com> <4cn97v$6on@fountain.mindlink.net>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <4cn97v$6on@fountain.mindlink.net>
  15.            genew@mindlink.bc.ca "Gene Wirchenko" writes:
  16.  
  17. >miker3@ix.netcom.com (Mike Rubenstein) wrote:
  18. >
  19.  
  20. ...
  21.  
  22. >>|>>                 for (i=0; i<50; i++) p++ = i;
  23.  
  24. ...
  25.  
  26. >>In what language is it legal?  Certainly not C which requires a
  27. >>modifiable lvalue as the right operand of = and defines p++ as not
  28. >>being an lvalue.
  29. >
  30. >>Michael M Rubenstein
  31. >
  32. >     Bull!  The RIGHT operand requires an L-value?  Ha!  That would
  33. >make:
  34.  
  35. Michael clearly meant 'left' when he wrote 'right' (since he referred to
  36. p++ which is on the left).  Only army C programmers have to know their
  37. left from their right! :-)
  38.  
  39. >     In the example above,
  40. >          p
  41. >is the L-value.  After being used as such, it is incremented.
  42.  
  43. And then p++ is used as the left operand of =. = requires an lvalue on
  44. its LHS which p++ is not, so the expression is illegal (in fact it violates
  45. a constraint and requires a diagnostic from the compiler).
  46.  
  47. -- 
  48. -----------------------------------------
  49. Lawrence Kirby | fred@genesis.demon.co.uk
  50. Wilts, England | 70734.126@compuserve.com
  51. -----------------------------------------
  52.